<?php


namespace app\common\validate;

use think\Validate;

// Category模型验证器类
class CateValidate extends Validate
{
    // 验证规则
    protected $rule = [
        'id' => 'require|unique:category',
        'catename|栏目名称' => 'require|min:2|max:32|unique:category',
        'sort|排序值' => 'require|number|between:1,99',
    ];

    // 添加场景验证
    public function sceneAddcate()
    {
        return $this->only(['catename', 'sort']);
    }

    // 编辑场景验证
    public function sceneEditcate()
    {
        return $this->only(['id', 'catename', 'sort']);
    }
}